<?=View::factory('admin/common/header')?>
<div id="content">
  <div class="breadcrumb">
    <a href="<?=URL::site('admin')?>">管理首页</a>
    &raquo; 商品列表
  </div>
  <?=View::factory('admin/common/message')?>
  <div class="box">
    <div class="heading">
      <h1><img src="<?=URL::site()?>images/admin/layout.png" alt="" /> 商品列表</h1>
      <div class="buttons">
        <input type="button" onclick="location='<?=URL::site('admin/store_item/add')?>'" class="btn45" value="添加" />
      </div>
    </div>
    <div class="content">
      <form method="get" name="item_search">
        <fieldset>
          <legend>商品搜索</legend>
          <div>
            关键字：<input type="text" name="keyword" value="<?=$keyword?>" size="30" /> &nbsp;
            <input type="submit" value="搜索" class="btn45" />
          </div>
        </fieldset>
      </form>
    <table class="list">
      <thead>
        <tr>
          <td class="center autosort" name="item_id" width="40">ID</td>
          <td class="left autosort" name="categories">分类</td>
          <td class="left autosort" name="title">标题</td>
          <td class="left autosort" name="spec">规格</td>
          <td class="left autosort" name="is_show" width="60">显示</td>
          <td class="right" width="100">操作</td>
        </tr>
      </thead>
      <tbody>
        <? foreach ($pagination as $item): ?>
        <tr>
          <td class="center"><?=$item['item_id']?></td>
          <td class="left">
            <? if ($item['categories']): ?>
                <? $categories = (array) explode(',', $item['categories']); ?>
                <? foreach ($categories as & $c): ?>
                  <? $c = Config::get('items.categories.'.$c); ?>
                <? endforeach; ?>
                <?=implode(', ', $categories)?>
            <? endif; ?>
          </td>
          <td class="left"><?=Str::highlight($item['title'], $keyword)?></td>
          <td class="left"><?=$item['spec']?></td>
          <td class="left"><img src="<?=URL::site()?>images/admin/<?=$item['is_show']?'yes':'no'?>.gif" /></td>
          <td class="right">
            [ <a href="<?=URL::redirect('admin/store_item/edit/'.$item['item_id'])?>">编辑</a> ]
            [ <a href="javascript: $.ajax_get({url:'<?=URL::site('admin/store_item/del/'.$item['item_id'])?>'}); void(0);" class="delete">删除</a> ]
          </td>
        </tr>
        <? endforeach; ?>
      </tbody>
    </table>
    <?=$pagination?>
    </div>
  </div>
</div>
<?=View::factory('admin/common/footer')?>
<script type="text/javascript">
$().ready(function(){
    $('#store_item').addClass('selected');
});
</script>